﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data.SqlClient;
using System.Data;

/// <summary>
/// Summary description for datDanToc
/// </summary>
public class datDanToc
{
	public datDanToc()
	{
		//
		// TODO: Add constructor logic here
		//
	}
    SqlCommand cmd;
    SqlDataReader dr;
    public List<entDanToc> getALL()
    {
        string constr = System.Configuration.ConfigurationManager.ConnectionStrings["conStr"].ConnectionString;
        SqlConnection sqlConnection = new SqlConnection(constr);
        sqlConnection.Open();
        cmd = new SqlCommand("sp_DanTocGetAll", sqlConnection);
        cmd.CommandType = CommandType.StoredProcedure;
        dr = cmd.ExecuteReader();
        entDanToc entDT;
        List<entDanToc> lst = new List<entDanToc>();
        while (dr.Read())
        {
            entDT = new entDanToc();
            entDT.DanTocId = int.Parse(dr["DanTocId"].ToString());
            entDT.Ten = dr["Ten"].ToString();
            lst.Add(entDT);
        }
        dr.Close();
        sqlConnection.Close();
        return lst;
    }
}